#include "function.h"


void print_num(int i)
{
    std::cout << i << std::endl;
}

void print_num_1(int i, int j)
{
    std::cout << i << " " << j << std::endl;
}

void Test()
{

    std::function<void (int)> f = print_num;
    f(-9);

    std::function<void (int)> f_lamdb = [] (int i) { std::cout << i << std::endl; };
    f_lamdb(9);

    std::function< void (int)> f_ff = f_lamdb;
    f_ff(20);

    std::function< void ()> f_lamdb_1 = []() {print_num(10);};
    f_lamdb_1();

    std::function <void ()> f_bind = std::bind(print_num, 20);
    f_bind();

    using std::placeholders::_1;
    using std::placeholders::_2;
    std::function<void (int , int)> f_bind_1 = std::bind(print_num_1, _1, _2);
    f_bind_1(10, 20);

    std::function<void (int, int) > f_bind_2 = std::bind(print_num_1, 50, _2);
    f_bind_2(20, 40);

   // std::function<void (const Foo&, int)> f_add_display = &Foo::print_add;
    //Foo foo(20);
    //f_add_display(foo, 500);

    std::function<void (int)> f_ds = PrintNum();
    f_ds(100);

    std::function<void (int)> f_add_display1 = Foo();
    f_add_display1(200);
}
